/*
 * UART2_Wireless.h
 *
 *  Created on: Jan 17, 2017
 *      Author: YzZe
 */

#ifndef UART2_WIRELESS_H_
#define UART2_WIRELESS_H_

#include "stm32f1xx_hal.h"

void Wireless_GPIO_Init(void);
void USART2_UART_Init(void);
void MX_DMA_Init(void);

extern UART_HandleTypeDef huart2;
extern DMA_HandleTypeDef hdma_usart2_rx;
#define Console_Buff_LEN 150
#define Console_RxState_Clear \
do{\
    Console_RX.Len = 0;\
    Console_RX.State = 0;\
    HAL_UART_Receive_DMA(&huart2, Console_RX.Data + Console_RX.Len, Console_Buff_LEN);  \
}while(0)



typedef struct Console_Rx_Data
{
    uint8_t Len;
    uint8_t State;
    uint8_t Data[Console_Buff_LEN];
} Rx_Data;

extern Rx_Data Console_RX;

void Console_Task_Init(void);
void Console_IRQ(void);


#define TASK_NNUMBER 5
#define MAX_COMMAND_LEN   25
#define MAX_COMMAND_NUM   20

void Normal_CMD(void);


#endif /* UART2_WIRELESS_H_ */
